package it.valeandre.omino.image;

import java.util.concurrent.LinkedBlockingDeque;

@SuppressWarnings("serial")
public class LimitedLIFO extends LinkedBlockingDeque<Runnable> {
	private int mMaxSize;
	
	@Override
	public boolean offer(Runnable e) {
		if (size() > mMaxSize) {
			Runnable removed = removeLast();
		}
		addFirst(e);
		return true;
	}
	
	public void setMaxSize(int maxSize) {
		mMaxSize = maxSize;
	}
}
